package com.ddtech.business.dance.controller;

import com.alibaba.fastjson.JSONObject;
import com.ddtech.business.dance.query.StandardDanceQuery;
import com.ddtech.business.dance.service.StandardDanceService;
import com.ddtech.business.dance.vo.req.StandardDanceReqVo;
import com.ddtech.framework.log.aop.log.Log;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @version v1.0
 * @ClassName:StandardDanceController description：
 * @author:wei_zhang(xiao)
 * @date: 2024-07-16 13:23
 */
@Api(tags = "标准舞蹈主表")
@RestController
@RequestMapping("/standardDance")
public class StandardDanceController {

    @Autowired
    private StandardDanceService standardDanceService;


    @Log("新增标准舞蹈")
    @ApiOperation(value = "新增标准舞蹈")
    @PostMapping(value = "/create")
    public ResponseEntity create(@RequestBody StandardDanceReqVo standardDanceReqVo) {
        String id=standardDanceService.create(standardDanceReqVo);
        JSONObject json = new JSONObject();
        json.put("id",id);
        return new ResponseEntity(json,HttpStatus.OK);
    }

    @Log("删除标准舞蹈")
    @ApiOperation(value = "删除标准舞蹈")
    @PostMapping(value = "/del/{id}")
    public ResponseEntity del(@PathVariable String id) {
        standardDanceService.del(id);
        return new ResponseEntity(true,HttpStatus.OK);
    }

    @Log("查询单个标准舞蹈")
    @ApiOperation(value = "查询单个标准舞蹈")
    @GetMapping(value = "/findOne/{id}")
    public ResponseEntity info(@PathVariable String id) {
        return new ResponseEntity(standardDanceService.info(id),HttpStatus.OK);
    }

    @Log("通过章节id查询标准舞蹈")
    @ApiOperation(value = "通过章节id查询标准舞蹈")
    @GetMapping(value = "/pageList")
    public ResponseEntity pageList(StandardDanceQuery standardDanceQuery) {
        return new ResponseEntity(standardDanceService.pageList(standardDanceQuery),HttpStatus.OK);
    }

}
